package Class;

import java.util.Scanner;

import org.junit.Test;

public class test {

	@Test
	public void test() {
		student stu = new student();
		stu.id = 7;
		stu.name = "张三";
		stu.year = 22;
		stu.className = "java190703";
		stu.study();
		String name = stu.name;
		System.out.println(name);
	}

	@Test
	public void test23() {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入学生数量：");
		int count = scanner.nextInt();
		student[] array = new student[count]; //int[] array = new int[count];student是类，属于引用数据类型
		for(int i = 0; i < array.length; i++) {
			student stu = new student();
			System.out.println("请输入学生id");
			int id = scanner.nextInt();
			stu.id = id;
			System.out.println("请输入学生的姓名：");
			String name = scanner.next();
			stu.name = name;
			array[i] = stu;
		}
		for(int i = 0; i < array.length; i++) {
			student stu = array[i];
			System.out.println(stu.id);
			System.out.println(stu.name);
			System.out.println(stu.year);
			System.out.println(stu.className);
		}
	}
	
	@Test
	public void test211() {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入教师数量：");
		int count = scanner.nextInt();
		teacher[] array = new teacher[count];
		for(int i = 0; i < array.length; i++) {
			teacher teach = new teacher();
			System.out.println("请输入教师编号：");
			int id = scanner.nextInt();
			teach.id = id;
			System.out.println("请输入姓名：");
			String name = scanner.next();
			teach.name = name;
			array[i] = teach;
		}
		for(int i = 0; i < array.length; i++) {
			teacher teach = array[i];
			System.out.println(teach.id);
			System.out.println(teach.name);
			System.out.println(teach.age);
			System.out.println(teach.className);
		}
	}
	
	@Test
	public void test2() {
		teacher teach = new teacher();
		teach.name = "李四";
		teach.className = "html";
		teach.teach();
	}
}
